var max=0;function AsylumNavLink(parentId,linkId,order,href,linkText,target,width)
{this.linkId=linkId;this.parentId=parentId;this.order=order;this.href=href;this.linkText=linkText;this.target=target;this.width=width;};function AsylumNav(contId,layout,offset)
{this.menuCont=document.getElementById(contId);this.layout=layout;this.offset=(typeof offset=='undefined'?'Right':offset);this.menuItems=new Object();this.clickUnderCreated=false;};AsylumNav.prototype.AddLink=function(parentId,linkId,order,href,linkText,target,width)
{if(typeof this.menuItems[parentId]=='undefined')
{this.menuItems[parentId]=new Object();}
if(typeof width=="undefined")width=false;this.menuItems[parentId][linkId]=new AsylumNavLink(parentId,linkId,order,href,linkText,target,width);if(order>max){max=order;}};AsylumNav.prototype.CreateLevel=function(levelId,idPrefix)
{obj=this;div=document.createElement('div');div.id=idPrefix+levelId;div.levelId=levelId;div.idPrefix=idPrefix;div.className='levelDiv';div.onmouseout=function(e){obj.HideLevel(e);};div.subLevels=new Object();if(levelId!='0')
{div.style.visibility='hidden';div.className+=' subLevel';div.style.position='absolute';}
else
{div.className+=' topLevel';}
if(this.layout=='Horizontal')
{div.style.position='absolute';}
div.style.zIndex=10;if(this.menuCont){this.menuCont.appendChild(div);}
for(i=0;i<=max;i++){for(linkId in this.menuItems[levelId]){if(this.menuItems[levelId][linkId].order==i){linkDiv=document.createElement('div');linkDiv.id='asylumNavLinkDiv'+linkId;linkDiv.linkId=linkId;linkDiv.levelId=levelId;linkDiv.className='linkDiv';if(levelId=="0"){linkDiv.className+=" topLevel";if(this.menuItems[levelId][linkId].width){linkDiv.style.width=this.menuItems[levelId][linkId].width+"px";}}
div.appendChild(linkDiv);navLink=this.menuItems[levelId][linkId];a=document.createElement('a');a.id='asylumNavLink'+linkId;a.linkType='navMenu';a.linkId=linkId;a.levelId=navLink.parentId;a.parentId=navLink.parentId;if(navLink.href==''||navLink.href=='#')
{a.href='#';a.target='';a.style.cursor='default';}
else
{a.href=navLink.href;a.target=navLink.target;}
if(this.layout=='Vertical')
{a.innerHTML=navLink.linkText;}
else
{a.innerHTML=navLink.linkText.split(' ').join('&nbsp;');}
a.onmouseover=function(){obj.ShowLevel(this);};linkDiv.appendChild(a);if(linkId==pageId)
{a.className='activeLink';linkDiv.className+=' activeLink';topLink=this.GetTopLevelLink(navLink);if(typeof this.menuItems[topLink.linkId]!='undefined'&&navLink.levelId!='0')
{try{document.getElementById('asylumNavLink'+topLink.linkId).className+=' activeLink';document.getElementById('asylumNavLinkDiv'+topLink.linkId).className+=' activeLink';}catch(e){}}
if(document.getElementById("clickUnder")!=null)
{this.CreateClickUnder(topLink,true);}}
else
{}
if(typeof this.menuItems[linkId]!='undefined')
{div.subLevels[linkId]=true;}}}}
return div;};AsylumNav.prototype.Construct=function()
{if(this.menuCont==null){return;}
var obj=this;for(levelId in this.menuItems)
{this.CreateLevel(levelId,'asylumNavLevel');}
if(this.layout=='Vertical')
{if(typeof document.getElementById('tplMainSectors')!=null)
{ms=document.getElementById('tplMainSectors');ms.style.height=ms.offsetHeight;}}
else
{this.menuCont.style.height=document.getElementById('asylumNavLevel0').offsetHeight+'px';}
this.CreateBreadCrumbs();};AsylumNav.prototype.CreateClickUnder=function(navLink,active)
{if(typeof doneClickUnder=="undefined"){doneClickUnder=true;}else{return;}
if(document.getElementById("clickUnder")==null)return;obj=this;var linkId;if(this.layout=='Vertical')
{clickDiv=document.createElement('div');clickDiv.id="clickUnder";document.getElementById("clickUnder").appendChild(clickDiv);linkDiv=document.getElementById('asylumNavLinkDiv'+navLink.linkId);linkDiv.appendChild(clickDiv);}
else
{clickDiv=document.getElementById("clickUnder");}
var linkCount=0;for(linkId in this.menuItems[navLink.linkId])
{linkCount++;clickLinkDiv=document.createElement('div');clickLinkDiv.className='clickLinkDiv';clickLink=this.menuItems[navLink.linkId][linkId];txt=document.createTextNode(' ');clickDiv.appendChild(txt);a=document.createElement('a');a.id='asylumNavClickLink'+clickLink.linkId;a.className='clickLink';a.linkType='clickLink';a.linkId=linkId;a.levelId=clickLink.parentId;a.parentId=clickLink.parentId;if(clickLink.href==''||clickLink.href=='#'){a.href='#';a.target='';a.style.cursor='default';}else{a.href=clickLink.href;a.target=clickLink.target;}
if(this.layout=="Vertical"){a.innerHTML=clickLink.linkText;}else if(this.layout=="Horizontal-SubMenu"){if(clickLink.linkText.substring(0,1)==" "){a.innerHTML=clickLink.linkText.split(" ").join("&nbsp;");}else{a.innerHTML=clickLink.linkText;}}else{a.innerHTML=clickLink.linkText.split(" ").join("&nbsp;");}
a.onmouseover=function(){obj.HideAllLevels();obj.ShowLevel(this);};a.onmouseout=function(e){obj.HideLevel(e);};clickLinkDiv.appendChild(a);if(linkId==pageId)
{a.className='activeLink';clickLinkDiv.className+=' activeLink';}
clickDiv.appendChild(clickLinkDiv);txt=document.createTextNode(' ');clickDiv.appendChild(txt);}
if(linkCount==0||active==false)
{clickDiv.className='inactiveClickUnder';}
else
{clickDiv.className='activeClickUnder';}};AsylumNav.prototype.GetTopLevelLink=function(navLink)
{if(navLink.parentId=='0')
{return(navLink);}
while(1==1)
{navLink=this.GetParentLink(navLink);if(typeof navLink.parentId!='undefined')
{if(navLink.parentId=='0')
{break;}}}
return(navLink);};AsylumNav.prototype.GetParentLink=function(navLink)
{var levelId;var linkId;for(levelId in this.menuItems)
{for(linkId in this.menuItems[levelId])
{parNavLink=this.menuItems[levelId][linkId];if(parNavLink.linkId==navLink.parentId)
{return(parNavLink);}}}};AsylumNav.prototype.GetXPos=function(obj)
{var curleft=0;if(obj.offsetParent)
{while(obj.offsetParent&&obj.id!='navMenuCont')
{curleft+=obj.offsetLeft;obj=obj.offsetParent;}}
else if(obj.x)
curleft+=obj.x;return curleft;};AsylumNav.prototype.GetYPos=function(obj)
{var curtop=0;if(obj.offsetParent)
{while(obj.offsetParent&&obj.id!='navMenuCont')
{curtop+=obj.offsetTop;obj=obj.offsetParent;}}
else if(obj.y)
curtop+=obj.y;return curtop;};AsylumNav.prototype.ShowLevel=function(el)
{levelId=el.linkId;this.currentLevelId=levelId;window.clearTimeout(this.timeoutId);this.HideSubLevels(el.levelId);if(typeof this.menuItems[levelId]=='undefined')
{return;}
if(el.linkType=='clickLink')
{eP=document.getElementById('asylumNavClickLink'+el.linkId);eL=document.getElementById('asylumNavLevel'+levelId);SwapClass(eL,'subLevel','clickUnderSubLevel');}
else
{eP=document.getElementById('asylumNavLink'+levelId);eL=document.getElementById('asylumNavLevel'+levelId);SwapClass(eL,'clickUnderSubLevel','subLevel');}
if(eP.parentId=='0')
{switch(this.offset)
{case'Right':offsetX=(eP.offsetWidth);offsetY=0;break;case'Left':offsetX=(-eL.offsetWidth);offsetY=0;break;case'Bottom':offsetX=0;offsetY=eP.offsetHeight;eL.style.minWidth=eP.offsetWidth;break;}}
else
{switch(this.offset)
{case'Left':offsetX=(-eL.offsetWidth);offsetY=0;break;default:offsetX=(eP.offsetWidth);offsetY=0;break;}}
pX=this.GetXPos(eP);pY=this.GetYPos(eP);lX=pX+offsetX;lY=pY+offsetY;eL.style.position='absolute';$(eL).css({left:lX,top:lY});eL.style.visibility='visible';};AsylumNav.prototype.GetLevelWidth=function(levelId)
{maxWidth=0;for(linkId in this.menuItems[levelId])
{a=document.getElementById('asylumNavLink'+linkId);thisWidth=a.offsetWidth;if(thisWidth>maxWidth)
{maxWidth=thisWidth;}}
return(maxWidth);};AsylumNav.prototype.HideSubLevels=function(levelId,omitLevelId)
{if(typeof omitLevelId=='undefined')
{omitLevelId='0';}
eL=document.getElementById('asylumNavLevel'+levelId);for(levelId in eL.subLevels)
{this.HideSubLevels(levelId);if(levelId!=omitLevelId)
{eL=document.getElementById('asylumNavLevel'+levelId);eL.style.visibility='hidden';}}};AsylumNav.prototype.HideLevel=function(e)
{window.clearTimeout(this.timeoutId);if(!e)e=window.event;var el=(e.relatedTarget)?e.relatedTarget:e.toElement;var obj=this;var funct=function(){obj._HideLevel(el);};this.timeoutId=window.setTimeout(funct,1000);};AsylumNav.prototype._HideLevel=function(el)
{if(!el||el.id.substr(0,9)!='asylumNav'||(el.id.substr(0,9)=='asylumNav'&&el.style.visibility=='hidden'))
{this.HideAllLevels();}};AsylumNav.prototype.HideAllLevels=function()
{for(levelId in this.menuItems)
{if(levelId!='0')
{eL=document.getElementById('asylumNavLevel'+levelId);if(eL!=null)eL.style.visibility='hidden';}}};AsylumNav.prototype.CreateBreadCrumbs=function()
{if(document.getElementById("breadCrumbs")!=null)
{crumbsCont=document.getElementById("breadCrumbs");crumbsCont.style.display='none';crumbs='';homeLink='';for(levelId in this.menuItems)
{for(linkId in this.menuItems[levelId])
{navLink=this.menuItems[levelId][linkId];if(homeLink=='')
{homeLink='<a href="'+navLink.href+'" target="'+navLink.target+'">'
+navLink.linkText+'</a> &gt; ';}
if(linkId==pageId)
{i=0;parNavLink=this.GetParentLink(navLink);while(typeof parNavLink=='object')
{i++;crumbs='<a href="'+parNavLink.href+'" target="'+parNavLink.target+'">'
+parNavLink.linkText+'</a> &gt; '+crumbs;parNavLink=this.GetParentLink(parNavLink);}
if(i>1)
{crumbsCont.style.display='block';crumbsCont.innerHTML=homeLink+crumbs+'<span class="activeCrumb">'+navLink.linkText+'</span>';}
return(true);}}}}};function RemoveClass(el,className)
{var replaceName=(el.className.match(' '+className)?' '+className:className);el.className=el.className.replace(replaceName,'');};function AddClass(el,className)
{RemoveClass(el,className);el.className+=' '+className;};function SwapClass(el,removeClassName,addClassName)
{RemoveClass(el,removeClassName);AddClass(el,addClassName);};;$(function() {for (var i in tasks) {window.setTimeout(tasks[i], 0);}});function initMenu(){};$(function(){$("#navMenu").navmenu({pageInfo:{"a109520":{"P":0,"ID":284948,"C":109520,"O":0,"U":"http:\/\/www.thomsonjones.co.nz\/","N":"Home","T":"_top","R":"","RT":"_blank"},"a229551":{"P":109520,"ID":290058,"C":229551,"O":"1","U":"http:\/\/www.thomsonjones.co.nz\/page290058.html","N":"Meet the Team","T":"_top","R":"","RT":"_blank"},"a109521":{"P":109520,"ID":111274,"C":109521,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/free-mortgage-service.html","N":"<b>Mortgages >><\/b>","T":"_top","R":"","RT":"_blank"},"a111248":{"P":109521,"ID":111276,"C":111248,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-finance-products.html","N":"Products","T":"_top","R":"","RT":"_blank"},"a111250":{"P":111248,"ID":111277,"C":111250,"O":"1","U":"http:\/\/www.thomsonjones.co.nz\/property-investors.html","N":"Property Investors","T":"_top","R":"","RT":"_blank"},"a111252":{"P":111248,"ID":111278,"C":111252,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/pre-approved-home-loans.html","N":"Pre-Approved Home Loans","T":"_top","R":"","RT":"_blank"},"a111268":{"P":111248,"ID":111284,"C":111268,"O":"4","U":"http:\/\/www.thomsonjones.co.nz\/self-employed-low-doc.html","N":"Self Employed","T":"_top","R":"","RT":"_blank"},"a111269":{"P":111248,"ID":111285,"C":111269,"O":"5","U":"http:\/\/www.thomsonjones.co.nz\/commission-bonus-based.html","N":"Commission\/Bonus Based Income","T":"_top","R":"","RT":"_blank"},"a111271":{"P":111248,"ID":111286,"C":111271,"O":"6","U":"http:\/\/www.thomsonjones.co.nz\/construction-mortgage-finance.html","N":"Construction Finance","T":"_top","R":"","RT":"_blank"},"a111272":{"P":111248,"ID":111287,"C":111272,"O":"7","U":"http:\/\/www.thomsonjones.co.nz\/bad-credit-mortgage.html","N":"Bad Credit","T":"_top","R":"","RT":"_blank"},"a111302":{"P":109521,"ID":111312,"C":111302,"O":"3","U":"http:\/\/www.thomsonjones.co.nz\/home-loans-kapiti.html","N":"Important info","T":"_top","R":"","RT":"_blank"},"a113393":{"P":111302,"ID":113481,"C":113393,"O":"1","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-finance-property.html","N":"Property Investors","T":"_top","R":"","RT":"_blank"},"a124516":{"P":111302,"ID":124526,"C":124516,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/emigrating-new-zealand.html","N":"Emigrating to New Zealand?","T":"_top","R":"","RT":"_blank"},"a113399":{"P":111302,"ID":113589,"C":113399,"O":"3","U":"http:\/\/www.thomsonjones.co.nz\/kiwisaver-mortgage-finance.html","N":"KiwiSaver","T":"_top","R":"","RT":"_blank"},"a113403":{"P":111302,"ID":116616,"C":113403,"O":"4","U":"http:\/\/www.thomsonjones.co.nz\/kapiti-coast-contacts.html","N":"Kapiti Coast Contacts","T":"_top","R":"","RT":"_blank"},"a111293":{"P":109521,"ID":111311,"C":111293,"O":"4","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-calculator.html","N":"Mortgage Repayment Calculator","T":"_top","R":"","RT":"_blank"},"a111299":{"P":109521,"ID":229580,"C":111299,"O":"5","U":"http:\/\/www.thomsonjones.co.nz\/property-finance-blog.html","N":"Blog","T":"_top","R":"","RT":"_blank"},"a177730":{"P":109521,"ID":177733,"C":177730,"O":"6","U":"http:\/\/www.thomsonjones.co.nz\/page177733.html","N":"Property\/Market Reports","T":"_top","R":"","RT":"_blank"},"a198882":{"P":177730,"ID":205014,"C":198882,"O":"1","U":"http:\/\/www.thomsonjones.co.nz\/page205014.html","N":"February &amp; March 08","T":"_top","R":"","RT":"_blank"},"a251381":{"P":177730,"ID":251393,"C":251381,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/page251393.html","N":"April &amp; May 08","T":"_top","R":"","RT":"_blank"},"a111300":{"P":109521,"ID":111314,"C":111300,"O":"7","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-brokers-jobs.html","N":"Brokers Wanted","T":"_top","R":"","RT":"_blank"},"a111489":{"P":109521,"ID":111496,"C":111489,"O":"8","U":"http:\/\/www.thomsonjones.co.nz\/testimonials-mortgage-insurance.html","N":"Testimonials","T":"_top","R":"","RT":"_blank"},"a111301":{"P":109521,"ID":111315,"C":111301,"O":"9","U":"http:\/\/www.thomsonjones.co.nz\/apply-now-online.html","N":"Apply Now!","T":"_top","R":"","RT":"_blank"},"a113723":{"P":109520,"ID":113724,"C":113723,"O":"3","U":"http:\/\/www.thomsonjones.co.nz\/how-much-can.html","N":"<i>Find out how much you can you borrow now!<\/i>","T":"_top","R":"","RT":"_blank"},"a111446":{"P":109520,"ID":111470,"C":111446,"O":"4","U":"http:\/\/www.thomsonjones.co.nz\/life-insurance-kapiti.html","N":"<b>Insurance >><\/b>","T":"_top","R":"","RT":"_blank"},"a111304":{"P":111446,"ID":111318,"C":111304,"O":"1","U":"http:\/\/www.thomsonjones.co.nz\/life-insurance-kapiti-coast.html","N":"Life Insurance","T":"_top","R":"","RT":"_blank"},"a111307":{"P":111446,"ID":111321,"C":111307,"O":"2","U":"http:\/\/www.thomsonjones.co.nz\/income-protection-insurance.html","N":"Income Protection Insurance","T":"_top","R":"","RT":"_blank"},"a111305":{"P":111446,"ID":111319,"C":111305,"O":"3","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-protection-insurance.html","N":"Mortgage Protection Insurance","T":"_top","R":"","RT":"_blank"},"a111306":{"P":111446,"ID":111320,"C":111306,"O":"4","U":"http:\/\/www.thomsonjones.co.nz\/lump-sum-trauma.html","N":"Lump Sum Trauma Insurance","T":"_top","R":"","RT":"_blank"},"a111308":{"P":111446,"ID":111322,"C":111308,"O":"5","U":"http:\/\/www.thomsonjones.co.nz\/health-insurance-kapiti.html","N":"Health Insurance","T":"_top","R":"","RT":"_blank"},"a111309":{"P":111446,"ID":111323,"C":111309,"O":"6","U":"http:\/\/www.thomsonjones.co.nz\/travel-insurance-kapiti.html","N":"Travel Insurance","T":"_top","R":"","RT":"_blank"},"a111310":{"P":111446,"ID":111324,"C":111310,"O":"7","U":"http:\/\/www.thomsonjones.co.nz\/business-insurance-kapiti.html","N":"Business Insurance","T":"_top","R":"","RT":"_blank"},"a109524":{"P":109520,"ID":111325,"C":109524,"O":"5","U":"http:\/\/www.thomsonjones.co.nz\/free-online-insurance.html","N":"<i>Get a free insurance quote now!<\/i>","T":"_top","R":"","RT":"_blank"},"a111491":{"P":109520,"ID":111497,"C":111491,"O":"6","U":"http:\/\/www.thomsonjones.co.nz\/mortgage-insurance-newsletter.html","N":"Thomson Jones e-News","T":"_top","R":"","RT":"_blank"},"a177431":{"P":109520,"ID":177610,"C":177431,"O":"7","U":"http:\/\/www.thomsonjones.co.nz\/page177610.html","N":"Home Buyer's Guide","T":"_top","R":"","RT":"_blank"},"a111493":{"P":109520,"ID":111498,"C":111493,"O":"11","U":"http:\/\/www.thomsonjones.co.nz\/commercial-property-finance.html","N":"Contact Us","T":"_top","R":"","RT":"_blank"}},alignment:"Vertical",animate:0})});